package org.wxd.common.utils;

import static java.util.Base64.*;

/**
 * Created by wangxd on 2016/11/5.
 * 将文件流字节码转为string，再将string转为文件流字节码
 */
public class Base64 {

    @SuppressWarnings("Since15")
    public static String enToString(byte[] buff){
        Assert.notNull(buff,"buff is not null.");
        return getEncoder().encodeToString(buff);
    }

    @SuppressWarnings("Since15")
    public static byte[] deToByte(String str){
        Assert.notNull(str,"str is not null");
        return getDecoder().decode(str);
    }
}
